/*
*	Copyright (C) 2014  Julio Montes, Mario Carrillo
*	
*	Julio Montes e-mail: imc.coder@gmail.com 
*
*	Mario Carrillo e-mail: mario_90ago@live.com.mx
*
*	BSD 3-Clause License
*/

#ifndef SDK_LEXER_H
#define SDK_LEXER_H

#include "sdk/include/filecfg.h"

#include <vector>
#include <wx/wx.h>

namespace sdk
{
    typedef struct styleLexer
    {
        wxString name;
        int index;
        wxColour foreground;
        wxColour background;
        bool bold;
        bool italic;
        bool underline;
    }styleLexer;

    typedef struct keywordsLexer
    {
        wxString name;
        size_t index;
        wxString keywords;
    }keywordsLexer;

    typedef struct imageLexer
    {
        size_t index;
        wxString image;
    }imageLexer;


    typedef std::vector<sdk::styleLexer> vectorStyles;
    typedef std::vector<sdk::keywordsLexer> vectorWords;
    typedef std::vector<sdk::imageLexer> vectorImages;

    class Lexer
    {
    public:
        Lexer();
        virtual ~Lexer();
        bool LoadFile( const wxString &filename );
        wxString GetName() const;
        wxString GetFileMask() const;
        wxString GetSupportedFiles() const;
        int GetIndex() const;
        bool HasFileMask( const wxString &fileMask ) const;
        bool HasSupportedFile( const wxString &fileName ) const;
        size_t GetStyles( sdk::vectorStyles *vectorStyles ) const;
        size_t GetKeywords( sdk::vectorWords *vectorWords ) const;
        size_t GetImages( sdk::vectorImages *vectorImages ) const;
        wxString GetWordsWith( const wxString &word, bool noCase=true ) const;
    protected:
    private:
        void Reload();

        sdk::FileConfig m_fileLexer;
        wxString m_filename;
        bool m_modified;
        std::vector<wxString> m_vectorWords;
    };
}

#endif // SDK_LEXER_H
